import 'package:flutter/material.dart';

class MyAnimatedWidget extends StatefulWidget {
  @override
  _MyAnimatedWidgetState createState() => _MyAnimatedWidgetState();
}

class _MyAnimatedWidgetState extends State {
  double _left = 0.0;

  void _moveRight() {
    setState(() {
      _left = 200.0;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        AnimatedPositioned(
          duration: Duration(seconds: 1),
          curve: Curves.easeOut,
          left: _left,
          top: 100,
          child: Container(
            width: 50,
            height: 50,
            color: Colors.blue,
          ),
        ),
        Positioned(
          bottom: 20,
          left: 0,
          right: 0,
          child: ElevatedButton(
            onPressed: _moveRight,
            child: Text('Move Right'),
          ),
        )
      ],
    );
  }
}